package cn.bopomo.dealer.base.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import cn.bopomo.dealer.base.common.CommonConstant;
import cn.bopomo.dealer.base.common.ServiceConfig;
import cn.bopomo.dealer.base.service.IOperatorService;

public class ShowAuthoirzeByModuleAction extends BaseAction {
	
	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		// TODO Auto-generated method stub
		String mid = request.getParameter("mid");
		
		if (mid == null){
			//报错
			return this.findFailure(mapping);
		}
		
		IOperatorService os = (IOperatorService)this.findService(ServiceConfig.OPERATOR_SERVICE);
		List authorizeList = os.getAuthorizesByModule(new Integer(mid));
		
		if (authorizeList != null && authorizeList.size() > 0 ){
			request.setAttribute(CommonConstant.KEY_AUTHORIZE_LIST,authorizeList);
		}
		
		return this.findSuccess(mapping);
	}
	
}
